package cheme.ProcessModel;

import java.util.ArrayList;
import java.util.List;

public class SimpleLogger 
{
	private static List<String> dissabledIds = new ArrayList<String>();
	private static boolean dissableAll = false;
	private static String lastId = "";
	
	public static boolean enable(String id)
	{
		return dissabledIds.remove(id);
	}
	
	public static boolean dissable(String id)
	{
		return (!dissabledIds.contains(id) && dissabledIds.add(id));
	}
	
	public static void dissallowAll(boolean diss)
	{
		dissableAll = diss;
	}
	
	private static boolean isEnabled(String id)
	{
		return !dissabledIds.contains(id);
	}
	
	public static void log(String id, String message)
	{
		if(!dissableAll && isEnabled(id))
		{
			String spacing = "";
			if(lastId == id)
			{
				spacing = "\t";
			}
			System.out.println(spacing + message);
			lastId = id;
		}
	}
	
	public static void log(String message)
	{
		if(!dissableAll)
		{
			System.out.println(message);
			lastId = "";
		}
	}

}
